home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / AIAT 1.0.1 / Headers / Corpus / StringCorpus.h < prev   
Encoding:
Text File  |  1997-09-11  |  1.2 KB  |  51 lines  |  [TEXT/CWIE]

  1. // StringCorpus.h
  2. //    Copyright:    © 1994 - 1997 by Apple Computer, Inc., all rights reserved.
  3.  
  4.  
  5. // a corpus that is a set of memory-resident strings
  6. // this is useful for test programs
  7.  
  8. #pragma once
  9. #ifndef StringCorpus_h
  10. #define StringCorpus_h
  11.  
  12. #include "IACorpus.h"
  13.  
  14. const uint32    StringCorpusType = 'Str0';
  15.  
  16. class StringDoc : public IADoc {
  17. public:
  18.                 StringDoc() : text(NULL), textLen(0) {}
  19.                 StringDoc(const char* text);
  20.                 StringDoc(char* text, uint32 textLen, bool makeCopy = true);
  21. //                StringDoc(StringDoc& fd) : IADoc(fd) {}
  22.     virtual        ~StringDoc();
  23.  
  24.     IAStorable*    DeepCopy() const;
  25.     uint32        StoreSize() const;
  26.     void        Store(IAOutputBlock* output) const;
  27.     IAStorable*    Restore(IAInputBlock* input) const;
  28.  
  29.     bool        LessThan(const IAOrderedStorable* neighbor) const;
  30.     bool        Equal(const IAOrderedStorable* neighbor) const;
  31.  
  32.     char*        GetText() const {return text;}
  33.     uint32        GetLength() const {return textLen;}
  34.     
  35. private:
  36.  
  37.     char*        text;
  38.     uint32        textLen;
  39. };
  40.  
  41. class StringCorpus : public IACorpus {
  42. public:    
  43.                 StringCorpus() : IACorpus(StringCorpusType) {}
  44. //                StringCorpus(StringCorpus& fc) : IACorpus(fc) {}
  45.     virtual        ~StringCorpus() {}
  46.     IADoc*        GetProtoDoc();
  47.     IADocText*    GetDocText(const IADoc* doc);
  48. };
  49.  
  50. #endif
  51.